<div id="nuevo" title="<?php echo __("Editando Mailing")?>" class="mailing">
	<form action="<?php echo url_for('mailing/'.($form->getObject()->isNew() ? 'create' : 'update').(!$form->getObject()->isNew() ? '?id='.$form->getObject()->getId() : '')) ?>" method="post" id="formNuevo" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
            <?php if (!$form->getObject()->isNew()): ?>
            <input type="hidden" name="sf_method" value="put" />
            <?php endif; ?>
            <?php echo $form->renderHiddenFields(false) ?> 
            <?php echo $form->renderGlobalErrors() ?>
    
            <div id="datosGrupo">
                <fieldset><legend>Grupo</legend>
                    <div class="margen_bottom_10">
                            <span class="label"><?php echo __('Nombre ');?> *:</span>
                            <span>
                                <?php echo $form['grupo_id']->renderError() ?>
                                <?php echo $form['grupo_id'] ?>
                            </span>
                    </div>
                </fieldset>
            </div>
            <div id="datosMailing" class="limpiar">
                <?php include_partial('mailing/editaMailing',array('form'=> $form))?>
            </div>
          
        </form>
</div>

<script language="JavaScript" type="text/javascript">
  	$(document).ready(function() { 
                var aceptar = function () { 
                    $('#formNuevo').submit();                    
  		};
                
  		var cancelar = function () {
  			$("#nuevo").dialog("destroy");
			$("#nuevo").remove();
			window.location =  "<?php echo url_for('@mailing'); ?>";
  		};
                //var eliminar = function () {
  		///	$("#editar").dialog("destroy");
		//	$("#editar").remove();
		//	window.location = "< ?php echo url_for('@mailing').'/delete/id/'.$form->getObject()->getId();?>";
  		//};
  		var dialogOpts = {
  			autoOpen: true,
  			width:850,
  			minHeight:600,
  			closeOnEscape: true,
  			modal: true,
  			buttons: {
  				"<?php echo __("Guardar")?>": aceptar,
                                //"< ?php echo __("Eliminar")?>": eliminar,
  				"<?php echo __("Cancelar")?>": cancelar
  			},
  			open: function() {
                                $(this).parent().find('button:nth-child(2)').focus();
                        },
                        resizable: true,
                        close: function() { location.href = "<?php echo url_for('@mailing'); ?>" },
                        //position: {my: "center top+20", at: "center top+20", of: window}
                };
  		$("#nuevo").dialog(dialogOpts);
        });
  </script>


<script language="JavaScript" type="text/javascript">
	$('input[type="text"]').focus(function() {
	    $(this).addClass("focus");
	    $(this).parent().parent().addClass("focustr");
	});
	$('input[type="text"]').blur(function() {
	    $(this).removeClass("focus");
	    $(this).parent().parent().removeClass("focustr");
	});
	$('textarea').focus(function() {
	    $(this).addClass("focus");
	    $(this).parent().parent().addClass("focustr");
	});
        $('textarea').blur(function() {
	    $(this).removeClass("focus");
	    $(this).parent().parent().removeClass("focustr");
	});
        $('select').focus(function() {
	    $(this).addClass("focus");
	    $(this).parent().parent().addClass("focustr");
	});
	$('select').blur(function() {
	    $(this).removeClass("focus");
	    $(this).parent().parent().removeClass("focustr");
	});
</script>

